Field of the Disclosure
Apparatuses and methods consistent with the exemplary embodiments relate to an electronic apparatus and method controlling the same, and more particularly to detecting a memory leak when executing an executable code.
Description of the Related Art
Executable codes being executed on computer systems often comprise dynamic memory allocation requests and dynamic memory deallocation requests. It is a common practice to prepare the executable code in a way that portions of the dynamic memory requested/allocated by executing of the dynamic memory allocation requests of said executable code are freed by executing of the respective dynamic memory allocation requests of said executable code. If the executable code fails to release the allocated dynamic memory before its execution is completed then it causes a memory leak, i.e. one or more portions of the dynamic memory remain allocated for the executable code after completion of the execution of the executable code. A special garbage collection software or service may free said not released dynamic memory after the completion of the execution of said executable code and thus compensate for said failures occurred during execution of said executable code. In the simplest case the user may simply reboot the computer in order to free all not deallocated portions of the dynamic memory. All these solutions may be at least partially effective, when the executable code is operated for a short time (i.e. no 24/7 continuous round-the-clock operation is required) and the ever increasing volume of the dynamic memory allocated for the execution of said executable code does not compromise operation of other executable codes executed on the same computer system and/or performance of the computer system itself. An ultimate solution would be to prepare an executable code upfront which is free of the aforementioned failures. This solution might be implemented when the executable code and/or source code used for generation of the executable code are relatively small, so that a software engineer is capable of finding all mistakes in at least one of said codes just by checking at least one of said codes and/or by executing the executable code in a debug mode. If the executable code is big, which is typically the case for modern industrial/commercial software, then there is a need for an automated system for memory leak detection.